package hc.bre

import com.fasterxml.jackson.annotation.JsonInclude
import hc.bre.cmn.RuleEmptyBuilder
import hc.bre.cmn.struct.DataStruct
import hc.bre.cmn.struct.DataStructItem
import hc.bre.variable.VariableDefinition
import java.lang.reflect.Field

@groovy.transform.CompileStatic
@groovy.transform.ToString(includeNames=true, includePackage = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
class ComponentConfig {
	String rtype
	String rname
	@com.fasterxml.jackson.annotation.JsonIgnore
	Class ruleClass;
	@com.fasterxml.jackson.annotation.JsonIgnore
	Class builderClass;

	String homepage;
	String objectpage;
	String description;
	DataStruct resultStruct;

	public Class getBuilderClass() {
		return builderClass?:RuleEmptyBuilder;
	}
	
	public String getHomepage() {
		return homepage?:'/rule/rulehome.htm?rtype=' + this.rtype;
	}

//	public void setHomepage(String homepage) {
//		this.homepage = homepage;
//	}

//	public DataStruct getResultStruct() {
//		if(resultStruct) return resultStruct;
//
//		Field field = hc.Util.getStaticField(ruleClass, DataStruct._nameInRuleDef);
//		if(field)
//		{
//			DataStruct struct = field.get(ruleClass) as DataStruct ;
//			return struct;
//		};
//
//		return null;
//	}

}